import instance from './config.js';



//  关键词搜索
export function searchWordsFn(keywords, limit = '30', type = '1') {
    return instance.get('/cloudsearch', {
        params: {
            keywords,
            limit,
            type,


        }
    })
}
//   获取歌词
export function getSongFn(id) {
    return instance.get('/lyric', {
        params: {
            id,

        }
    })
}
//  获取歌曲url
export function getSrlFn(id) {
    return instance.get("/song/url", {
        params: {
            id,

        }
    })
}
//  获取歌曲信息
export function getInfoFn() {
    return instance.get("/song/detail", {
        params: {
            ids: 1875941511,

        }
    })
}
//  获取轮播图资源
export function getBannerFn() {
    return instance.get("/banner", {
        params: 0,

    })
}
export function getPersonalized(index) {
    return instance.get("/personalized", {
        params: {
            limit: index,

        }
    })
}
export function getDjprogramFn() {
    return instance.get("/personalized/djprogram",)
}
// 获取云音乐首页新碟上架数据
export function getNewDiscFn() {
    return instance.get("/album/newest",)
}
//  获取所有榜单
export function getPlaylistFn() {
    return instance.get("/toplist",)
}
//  获取歌单所有歌曲
export function getPlaylistAllFn(id, limit = 10, offset = 0) {
    return instance.get("/playlist/track/all", {
        params: {
            id,
            limit,
            offset,

        }
    })
}
//  获取热门歌手
export function getHotSingerFn() {
    return instance.get("/dj/toplist/popular", {
        params: {
            limit: 5,

        }
    })
}
// 获取登录状态

export function getLoginStatusFn() {
    return instance.get(`/login/status?${Date.now()}`,)
}
// 获取二维码key值
export function getLoginQrKeyFn() {
    return instance.get(`/login/qr/key?${Date.now()}`)
}
// 获取二维码base64图片
export function getLoginQrCreateFn(key) {
    return instance.get(`/login/qr/create?${Date.now()}`, {
        params: {
            key,
            qrimg: true,

        },

    })
}
//  查看二维码状态
export function getLoginQrCheck(key) {
    return instance.get(`/login/qr/check?${Date.now()}`, {
        params: {
            key,

        },

    })
}
// 获取账户信息

export function getUserAccountFn() {

    return instance.get(`/user/account?${Date.now()}`,
    )
}

//  歌曲评论
export function getCommentMusicFn(id, index = 1) {
    return instance.get("/comment/music", {
        params: {
            id,
            limit: 20,
            offset: (index - 1) * 20,

        }
    })
}
//  歌单评论
export function getCommentPlaylistFn(id, index = 1) {
    return instance.get("/comment/playlist", {
        params: {
            id,
            limit: 20,
            offset: (index - 1) * 20,
        }
    })
}
// 回复评论
export function replyCommentFn() {

    // return new Promise(function (resolve) {
    //     window.alert("banrkapi 暂时出现问题,无法使用");
    //     resolve({ data: "" });
    // })

    return instance.get(`/comment${Date.now()}`, {
        params: {
            t: 2,
            type: 0,
            id: 1875941511,
            content: "women",
            commentId: 5600366046
        }

    })

}

//  邮箱登录
export function getLoginFn(email, password) {
    return instance.get("/login", {
        params: {
            email,
            password,
        }
    })
}
// 获取歌曲详情
export function getSongDeteilFn(ids) {
    return instance.get("/song/detail", {
        params: {
            ids
        }
    })
}
//  获取歌单详情
export function getPlaylistDetailFn(id) {
    return instance.get('/playlist/detail', {
        params: {
            id,
        }
    })
}
//  获取搜索建议
export function getSearchSuggestFn(keywords) {
    return instance.get('/search/suggest', {
        params: {
            keywords,
        }
    })
}
//  获取搜索结果
export function getCloudsearch(keywords, limit = 20, type = 1) {
    return instance.get("/cloudsearch", {
        params: {
            keywords,
            limit,
            type,
        }
    })
}
















